home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333)))) 22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- diagnostics - Perl compiler pragma to force verbose warning
- diagnostics
-
- splain - standalone program to do the same thing
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- As a pragma:
-
- use diagnostics;
- use diagnostics -verbose;
-
- enable diagnostics;
- disable diagnostics;
-
- Aa a program:
-
- perl program 2>diag.out
- splain [-v] [-p] diag.out
-
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- TTTThhhheeee ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss Pragma
-
- This module extends the terse diagnostics normally emitted
- by both the perl compiler and the perl interpeter,
- augmenting them with the more explicative and endearing
- descriptions found in the _p_e_r_l_d_i_a_g manpage. Like the other
- pragmata, it affects the compilation phase of your program
- rather than merely the execution phase.
-
- To use in your program as a pragma, merely invoke
-
- use diagnostics;
-
- at the start (or near the start) of your program. (Note
- that this _d_o_e_s enable perl's ----wwww flag.) Your whole
- compilation will then be _s_u_b_j_e_c_t(ed :-) to the enhanced
- diagnostics. These still go out SSSSTTTTDDDDEEEERRRRRRRR.
-
- Due to the interaction between runtime and compiletime
- issues, and because it's probably not a very good idea
- anyway, you may not use no diagnostics to turn them off at
- compiletime. However, you may control there behaviour at
- runtime using the _d_i_s_a_b_l_e() and _e_n_a_b_l_e() methods to turn
- them off and on respectively.
-
- The ----vvvveeeerrrrbbbboooosssseeee flag first prints out the the _p_e_r_l_d_i_a_g manpage
- introduction before any other diagnostics. The
- $diagnostics::PRETTY variable can generate nicer escape
- sequences for pagers.
-
-
-
-
- Page 1 (printed 10/23/98)
-
-
-
-
-
-
- ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333)))) 22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333))))
-
-
-
- TTTThhhheeee _s_p_l_a_i_n Program
-
- While apparently a whole nuther program, _s_p_l_a_i_n is actually
- nothing more than a link to the (executable) _d_i_a_g_n_o_s_t_i_c_s._p_m
- module, as well as a link to the _d_i_a_g_n_o_s_t_i_c_s._p_o_d
- documentation. The ----vvvv flag is like the use diagnostics
- -verbose directive. The ----pppp flag is like the
- $diagnostics::PRETTY variable. Since you're post-processing
- with _s_p_l_a_i_n, there's no sense in being able to _e_n_a_b_l_e() or
- _d_i_s_a_b_l_e() processing.
-
- Output from _s_p_l_a_i_n is directed to SSSSTTTTDDDDOOOOUUUUTTTT, unlike the pragma.
-
- EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
- The following file is certain to trigger a few errors at
- both runtime and compiletime:
-
- use diagnostics;
- print NOWHERE "nothing\n";
- print STDERR "\n\tThis message should be unadorned.\n";
- warn "\tThis is a user warning";
- print "\nDIAGNOSTIC TESTER: Please enter a <CR> here: ";
- my $a, $b = scalar <STDIN>;
- print "\n";
- print $x/$y;
-
- If you prefer to run your program first and look at its
- problem afterwards, do this:
-
- perl -w test.pl 2>test.out
- ./splain < test.out
-
- Note that this is not in general possible in shells of more
- dubious heritage, as the theoretical
-
- (perl -w test.pl >/dev/tty) >& test.out
- ./splain < test.out
-
- Because you just moved the existing ssssttttddddoooouuuutttt to somewhere
- else.
-
- If you don't want to modify your source code, but still have
- on-the-fly warnings, do this:
-
- exec 3>&1; perl -w test.pl 2>&1 1>&3 3>&- | splain 1>&2 3>&-
-
- Nifty, eh?
-
- If you want to control warnings on the fly, do something
- like this. Make sure you do the use first, or you won't be
- able to get at the _e_n_a_b_l_e() or _d_i_s_a_b_l_e() methods.
-
-
-
-
- Page 2 (printed 10/23/98)
-
-
-
-
-
-
- ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333)))) 22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333))))
-
-
-
- use diagnostics; # checks entire compilation phase
- print "\ntime for 1st bogus diags: SQUAWKINGS\n";
- print BOGUS1 'nada';
- print "done with 1st bogus\n";
-
- disable diagnostics; # only turns off runtime warnings
- print "\ntime for 2nd bogus: (squelched)\n";
- print BOGUS2 'nada';
- print "done with 2nd bogus\n";
-
- enable diagnostics; # turns back on runtime warnings
- print "\ntime for 3rd bogus: SQUAWKINGS\n";
- print BOGUS3 'nada';
- print "done with 3rd bogus\n";
-
- disable diagnostics;
- print "\ntime for 4th bogus: (squelched)\n";
- print BOGUS4 'nada';
- print "done with 4th bogus\n";
-
-
- IIIINNNNTTTTEEEERRRRNNNNAAAALLLLSSSS
- Diagnostic messages derive from the _p_e_r_l_d_i_a_g._p_o_d file when
- available at runtime. Otherwise, they may be embedded in
- the file itself when the splain package is built. See the
- _M_a_k_e_f_i_l_e for details.
-
- If an extant $SIG{__WARN__} handler is discovered, it will
- continue to be honored, but only after the
- _d_i_a_g_n_o_s_t_i_c_s::_s_p_l_a_i_n_t_h_i_s() function (the module's
- $SIG{__WARN__} interceptor) has had its way with your
- warnings.
-
- There is a $diagnostics::DEBUG variable you may set if
- you're desperately curious what sorts of things are being
- intercepted.
-
- BEGIN { $diagnostics::DEBUG = 1 }
-
-
- BBBBUUUUGGGGSSSS
- Not being able to say "no diagnostics" is annoying, but may
- not be insurmountable.
-
- The -pretty directive is called too late to affect matters.
- You have to do this instead, and _b_e_f_o_r_e you load the module.
-
- BEGIN { $diagnostics::PRETTY = 1 }
-
- I could start up faster by delaying compilation until it
- should be needed, but this gets a "panic: top_level" when
- using the pragma form in Perl 5.001e.
-
-
-
- Page 3 (printed 10/23/98)
-
-
-
-
-
-
- ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333)))) 22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222)))) ddddiiiiaaaaggggnnnnoooossssttttiiiiccccssss((((3333))))
-
-
-
- While it's true that this documentation is somewhat
- subserious, if you use a program named _s_p_l_a_i_n, you should
- expect a bit of whimsy.
-
- AAAAUUUUTTTTHHHHOOOORRRR
- Tom Christiansen <_t_c_h_r_i_s_t@_m_o_x._p_e_r_l._c_o_m>, 25 June 1995.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 4 (printed 10/23/98)
-
-
-
-